﻿using CloudStorageLight.Core;
using CloudStorageLight.Core.Web;
using CloudStorageLight.Web.Models;
using Microsoft.AspNet.Identity.Owin;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;

namespace CloudStorageLight.Web.Controllers
{
    public class WorkTaskController : WorkTaskControllerBase
    {
        protected override BlobService CreateBlobService()
        {
            return new BlobService();
        }

        public ApplicationUserManager UserManager
        {
            get
            {
                _userManager = _userManager ?? OwinContextExtensions.GetUserManager<ApplicationUserManager>(HttpContext.GetOwinContext());
                return _userManager;
            }
            private set
            {
                _userManager = value;
            }
        }
        private ApplicationUserManager _userManager;

        protected override BlobUser GetCurrentUser()
        {
            if (_user == null)
            {
                _user = BasicAuthenticateUtil.GetCurrentUser();
            }
            return _user;
        }
        private BlobUser _user;
    }
}